

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/e-page/news/img/favicon.ico">
  <link rel="icon" href="/e-page/news/img/favicon.ico">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="YanpingDong">
  <meta name="keywords" content="">
  
    <meta name="description" content="构建工具发展概述一般Java程序的开发过程为：编译，测试，打包。这个过程可以称为构建过程，如果文件比较少，可以使用java, javac, jar命令去做这些事情。但当项目比较复杂，需要编译的文件比较多时，使用命令行的方式就比较繁琐，而且容易出错。 所以开发了自动构建工具帮助开发人员自动化构建过程，其中ant就是其中一种构建工具，算是比较早期的一个，它提供了一套完整的构建脚本，可以自动完成编译，测">
<meta property="og:type" content="article">
<meta property="og:title" content="java构建工具ant简述">
<meta property="og:url" content="https://yanpingdong.gitee.io/e-page/2023/10/09/java-build-tool-ant/index.html">
<meta property="og:site_name" content="e-page">
<meta property="og:description" content="构建工具发展概述一般Java程序的开发过程为：编译，测试，打包。这个过程可以称为构建过程，如果文件比较少，可以使用java, javac, jar命令去做这些事情。但当项目比较复杂，需要编译的文件比较多时，使用命令行的方式就比较繁琐，而且容易出错。 所以开发了自动构建工具帮助开发人员自动化构建过程，其中ant就是其中一种构建工具，算是比较早期的一个，它提供了一套完整的构建脚本，可以自动完成编译，测">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://yanpingdong.gitee.io/e-page/news/2023/10/09/java-build-tool-ant/pic/ant-dependences-demo.png">
<meta property="article:published_time" content="2023-10-09T07:28:06.000Z">
<meta property="article:modified_time" content="2023-10-10T06:23:58.253Z">
<meta property="article:author" content="YanpingDong">
<meta property="article:tag" content="java">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://yanpingdong.gitee.io/e-page/news/2023/10/09/java-build-tool-ant/pic/ant-dependences-demo.png">
  
  
  
  <title>java构建工具ant简述 - e-page</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/e-page/news/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/e-page/news/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/e-page/news/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"yanpingdong.gitee.io","root":"/e-page/news/","version":"1.9.5-a","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":{"measurement_id":null},"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/e-page/news/local-search.xml","include_content_in_search":true};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/e-page/news/js/utils.js" ></script>
  <script  src="/e-page/news/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 6.3.0"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 60vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/e-page/news/">
      <strong>e-page</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/e-page/news/../">
                <i class="iconfont icon-home-fill"></i>
                <span>Home</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/e-page/news/">
                <i class="iconfont icon-books"></i>
                <span>News</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/e-page/news/archives/">
                <i class="iconfont icon-archive-fill"></i>
                <span>Archives</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/e-page/news/categories/">
                <i class="iconfont icon-category-fill"></i>
                <span>Categories</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/e-page/news/tags/">
                <i class="iconfont icon-tags-fill"></i>
                <span>Tag</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/e-page/news/about/">
                <i class="iconfont icon-user-fill"></i>
                <span>About</span>
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              <i class="iconfont icon-search"></i>
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">
              <i class="iconfont icon-dark" id="color-toggle-icon"></i>
            </a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/e-page/news/img/bg/banner.jpg') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="java构建工具ant简述"></span>
          
        </div>

        
          
  <div class="mt-3">
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2023-10-09 15:28" pubdate>
          2023年10月9日 下午
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          8k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          67 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <h1 id="seo-header">java构建工具ant简述</h1>
            
            
              <div class="markdown-body">
                
                <h1 id="构建工具发展概述"><a href="#构建工具发展概述" class="headerlink" title="构建工具发展概述"></a>构建工具发展概述</h1><p>一般Java程序的开发过程为：编译，测试，打包。这个过程可以称为构建过程，如果文件比较少，可以使用java, javac, jar命令去做这些事情。但当项目比较复杂，需要编译的文件比较多时，使用命令行的方式就比较繁琐，而且容易出错。</p>
<p>所以开发了自动构建工具帮助开发人员自动化构建过程，其中ant就是其中一种构建工具，算是比较早期的一个，它提供了一套完整的构建脚本，可以自动完成编译，测试，打包等工作。ant的思想和makefile比较像。定义一个任务，规定它的目标（target）之间的依赖，然后就可以通过ant来执行这个任务了。</p>
<p>但ant有一个很致命的缺陷，那就是没办法管理依赖。如果一个工程，要使用很多第三方开发包。每次打包都要手动去把正确的版本下载你并拷到lib目录中。所以为了解决这个依赖管理的问题，ant引入了ivy（ivy是记录、跟踪、解析和报告项目依赖的工具）。</p>
<p>如上所属，你需要两个工具来配合使用，一个是ant，一个是ivy才能完成一个项目的构建。这个时候Maven就出现了，它整合了ant和ivy，并且提供了很多插件，可以完成很多构建任务。其中maven最核心的改进就在于提出仓库这个概念。可以把所有依赖的包，都放到仓库里去，在工程管理文件里，标明需要什么包，什么版本。在构建的时候，maven就自动帮我把这些包打到包里来。为了达到这个目标，maven提出，要给每个包都标上坐标，这样便于在仓库里进行查找。所以，使用maven构建和发布的包都会按照这个约定定义自己的坐标（即：groupId,artifactId,version）。同时maven里抛弃了ant中通过target定义任务的做法，而是引入了生命周期的概念。</p>
<p>由于ant和Maven都是使用XML定义构建过程。有人嫌弃不够简洁，同时maven不鼓励自己定义任务，它要求用户在maven的生命周期中使用插件的方式去工作,强调约定优于配置，当然这样可以减少很多人为的错误。但有人不喜欢所以gradle又出现了。它抛弃了XML，使用Groovy语言来描述构建过程。并且充分地使用了maven的现有资源。继承了maven中仓库，坐标，依赖这些核心概念。文件的布局也和maven相同。但同时，它又继承了ant中target的概念，又让用户可以自定义任务(gradle中叫做task)，使用gradle，任务又变成了核心概念。</p>
<h1 id="构建工具ant"><a href="#构建工具ant" class="headerlink" title="构建工具ant"></a>构建工具ant</h1><p>ant的工作完全基于一个XML文件，这个文件定义了构建过程。如下所示，ant定义了五个任务，init, compile, build, test, clean。每个任务做什么都定义清楚了。打包之前要先编译，所以通过depends来指定依赖的路径。如果在命令行里执行ant build，那就会先执行compile，而compile又依赖于init，所以就会先执行init。目前来看使用ant的人不多，因为ant的配置文件比较复杂，而且使用XML定义任务的方式，让用户觉得比较繁琐。这里只是简单介绍下ant，让大家有个大概的了解。</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-meta">&lt;?xml version=<span class="hljs-string">&quot;1.0&quot;</span> encoding=<span class="hljs-string">&quot;UTF-8&quot;</span> ?&gt;</span>  <br><span class="hljs-tag">&lt;<span class="hljs-name">project</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;HelloWorld&quot;</span> <span class="hljs-attr">default</span>=<span class="hljs-string">&quot;run&quot;</span> <span class="hljs-attr">basedir</span>=<span class="hljs-string">&quot;.&quot;</span>&gt;</span>  <br><span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;src&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;src&quot;</span>/&gt;</span>  <br><span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;dest&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;classes&quot;</span>/&gt;</span>  <br><span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;jarfile&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;helloworld.jar&quot;</span>/&gt;</span>  <br><span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;init&quot;</span>&gt;</span>  <br>   <span class="hljs-tag">&lt;<span class="hljs-name">mkdir</span> <span class="hljs-attr">dir</span>=<span class="hljs-string">&quot;$&#123;dest&#125;&quot;</span>/&gt;</span>  <br><span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span>  <br><span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;compile&quot;</span> <span class="hljs-attr">depends</span>=<span class="hljs-string">&quot;init&quot;</span>&gt;</span>  <br>   <span class="hljs-tag">&lt;<span class="hljs-name">javac</span> <span class="hljs-attr">srcdir</span>=<span class="hljs-string">&quot;$&#123;src&#125;&quot;</span> <span class="hljs-attr">destdir</span>=<span class="hljs-string">&quot;$&#123;dest&#125;&quot;</span>/&gt;</span>  <br><span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span>  <br><span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;build&quot;</span> <span class="hljs-attr">depends</span>=<span class="hljs-string">&quot;compile&quot;</span>&gt;</span>  <br>   <span class="hljs-tag">&lt;<span class="hljs-name">jar</span> <span class="hljs-attr">jarfile</span>=<span class="hljs-string">&quot;$&#123;jarfile&#125;&quot;</span> <span class="hljs-attr">basedir</span>=<span class="hljs-string">&quot;$&#123;dest&#125;&quot;</span>/&gt;</span>  <br><span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span>  <br><span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;test&quot;</span> <span class="hljs-attr">depends</span>=<span class="hljs-string">&quot;build&quot;</span>&gt;</span>  <br>   <span class="hljs-tag">&lt;<span class="hljs-name">java</span> <span class="hljs-attr">classname</span>=<span class="hljs-string">&quot;com.first.HelloWorld&quot;</span> <span class="hljs-attr">classpath</span>=<span class="hljs-string">&quot;$&#123;hello_jar&#125;&quot;</span>/&gt;</span>  <br><span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span>  <br><span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;clean&quot;</span>&gt;</span>  <br>   <span class="hljs-tag">&lt;<span class="hljs-name">delete</span> <span class="hljs-attr">dir</span>=<span class="hljs-string">&quot;$&#123;dest&#125;&quot;</span> /&gt;</span>  <br>   <span class="hljs-tag">&lt;<span class="hljs-name">delete</span> <span class="hljs-attr">file</span>=<span class="hljs-string">&quot;$&#123;hello_jar&#125;&quot;</span> /&gt;</span>  <br><span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span>  <br><span class="hljs-tag">&lt;/<span class="hljs-name">project</span>&gt;</span>  <br></code></pre></td></tr></table></figure>

<p>上面是一个简单的ant脚本。下面看一个有依赖关系的项目，这样也方便理解Ant中的build.xml文件中工程之间的依赖与编译顺序，我们可以做如下假设的工程的一个Build.xml来看一下。</p>
<p><strong>工程假设</strong><br>假设工程有两部分组成，PrimaryPart（PP）和MinorPart(MP)两部分组成。PP依赖MP生成的Jar文件</p>
<p><strong>PP路径</strong></p>
<ul>
<li>src2.path：代码存放位置</li>
<li>src2.class.dir：代码编译后.class存放位置</li>
<li>依赖的其它工程存方位置（classpath）：${dist}&#x2F;lib 就是MP的Jar文件打包存放位置</li>
</ul>
<p><strong>MP路径</strong></p>
<ul>
<li>src1.path：代码存放位置</li>
<li>src1.class.dir：代码编译后.class存放位置</li>
<li>dist：MP的.class文件打包存放位置</li>
<li>依赖的其它工程存方位置(classpath)：工程根目录&#x2F;lib,additional.path</li>
</ul>
<p>简单的梳理下依赖关系：PM依赖MP打包好的任务“jar.bases.services”，而”jar.bases.services”任务依赖”compile.bases.services“MP的编译任务。这可以理解成，先编译MP工程然后把期.class打包成Jar包，然后PM引用Jar包来生成自己。工程需要自然匹配在一起</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-meta">&lt;?xml version=<span class="hljs-string">&quot;1.0&quot;</span> encoding=<span class="hljs-string">&quot;UTF-8&quot;</span> ?&gt;</span><br><br><span class="hljs-tag">&lt;<span class="hljs-name">project</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;JavaBuildProcess&quot;</span> <span class="hljs-attr">default</span>=<span class="hljs-string">&quot;compile&quot;</span> <span class="hljs-attr">basedir</span>=<span class="hljs-string">&quot;.&quot;</span></span><br><span class="hljs-tag">         <span class="hljs-attr">xmlns:artifact</span>=<span class="hljs-string">&quot;antlib:org.apache.maven.artifact.ant&quot;</span>&gt;</span><br>   <span class="hljs-comment">&lt;!--source1 saved position--&gt;</span><br>   <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;src1.path&quot;</span> <span class="hljs-attr">location</span>=<span class="hljs-string">&quot;where.your.source.saved&quot;</span>/&gt;</span><br>   <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;src1.class.dir&quot;</span> <span class="hljs-attr">location</span>=<span class="hljs-string">&quot;where.do.you.want.to.save.the.class.file&quot;</span>/&gt;</span><br>   <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;dist&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;where.do.you.want.to.save.the.jarfile&quot;</span>&gt;</span><br>   <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;additional.path&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;additional.path.that.saved.depends.jar.file&quot;</span>&gt;</span><br>   <span class="hljs-comment">&lt;!--src1 classpath--&gt;</span>    <br>   <span class="hljs-tag">&lt;<span class="hljs-name">path</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;src1.class.path&quot;</span>&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-name">pathelement</span> <span class="hljs-attr">location</span>=<span class="hljs-string">&quot;lib/&quot;</span>/&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-name">pathelement</span> <span class="hljs-attr">path</span>=<span class="hljs-string">&quot;$&#123;additional.path&#125;&quot;</span>/&gt;</span><br>   <span class="hljs-tag">&lt;/<span class="hljs-name">path</span>&gt;</span><br><br>   <span class="hljs-comment">&lt;!--compile Base Services--&gt;</span>     <br>   <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;compile.bases.services&quot;</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">javac</span> <span class="hljs-attr">srcdir</span>=<span class="hljs-string">&quot;$&#123;src1.path&#125;&quot;</span> <span class="hljs-attr">destdir</span>=<span class="hljs-string">&quot;$&#123;src1.class.dir&#125;&quot;</span> &gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-name">classpath</span> <span class="hljs-attr">refid</span>=<span class="hljs-string">&quot;src1.class.path&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-name">javac</span>&gt;</span><br>   <span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span><br><br>   <span class="hljs-comment">&lt;!--jar the src1.class file--&gt;</span><br>   <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;jar.bases.services&quot;</span> <span class="hljs-attr">depends</span>=<span class="hljs-string">&quot;compile.bases.services&quot;</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">jar</span> <span class="hljs-attr">destfile</span>=<span class="hljs-string">&quot;$&#123;dist&#125;/lib/baseservices.jar&quot;</span> <span class="hljs-attr">basedir</span>=<span class="hljs-string">&quot;$&#123;src1.class.dir&#125;&quot;</span> &gt;</span><br>   <span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span><br><br>   <span class="hljs-comment">&lt;!--source2 saved position--&gt;</span><br>   <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;src2.path&quot;</span> <span class="hljs-attr">location</span>=<span class="hljs-string">&quot;where.your.source.saved&quot;</span>/&gt;</span><br>   <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;src2.class.dir&quot;</span> <span class="hljs-attr">location</span>=<span class="hljs-string">&quot;where.do.you.want.to.save.the.class.file&quot;</span>/&gt;</span><br>   <span class="hljs-comment">&lt;!--compile Services--&gt;</span> <br>    <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;compile&quot;</span> <span class="hljs-attr">depends</span>=<span class="hljs-string">&quot;jar.bases.services&quot;</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">javac</span> <span class="hljs-attr">srcdir</span>=<span class="hljs-string">&quot;$&#123;src2.path&#125;&quot;</span></span><br><span class="hljs-tag">            <span class="hljs-attr">destdir</span>=<span class="hljs-string">&quot;$&#123;src2.class.dir&#125;&quot;</span></span><br><span class="hljs-tag">            <span class="hljs-attr">classpath</span>=<span class="hljs-string">&quot;$&#123;dist&#125;/lib&quot;</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-name">javac</span>&gt;</span><br>    <span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span><br><br><span class="hljs-tag">&lt;/<span class="hljs-name">project</span>&gt;</span><br></code></pre></td></tr></table></figure>

<p>整个过程如下图所示:</p>
<p><img src="/e-page/news/2023/10/09/java-build-tool-ant/pic/ant-dependences-demo.png" srcset="/e-page/news/img/loading.gif" lazyload></p>
<p>如上build.xml，用户需要明确的知道被依赖的jar包的位置，这样在编译最终的PM项目的时候在classpath位置才能明确的依赖jar包。</p>
<p>下面来看两个比较常用的特性：宏和内置JVM系统属性。</p>
<h2 id="Ant-macro宏使用"><a href="#Ant-macro宏使用" class="headerlink" title="Ant macro宏使用"></a>Ant macro宏使用</h2><p>Ant macro宏定义，可以定义一个macro，然后使用该macro，这样就可以避免重复定义。</p>
<p>简单宏示例，下面定义了一个宏叫做macro，在macrtest上使用的时候对启宗的attParam进行了付值。</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-meta">&lt;?xml version=<span class="hljs-string">&quot;1.0&quot;</span> encoding=<span class="hljs-string">&quot;UTF-8&quot;</span> ?&gt;</span><br><br><span class="hljs-tag">&lt;<span class="hljs-name">project</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;attribute&quot;</span> <span class="hljs-attr">default</span>=<span class="hljs-string">&quot;macrtest&quot;</span> &gt;</span><br><br>    <span class="hljs-tag">&lt;<span class="hljs-name">macrodef</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;macro&quot;</span>&gt;</span><br>              <span class="hljs-tag">&lt;<span class="hljs-name">attribute</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;attParam&quot;</span> <span class="hljs-attr">description</span>=<span class="hljs-string">&quot;input the attParam value&quot;</span>/&gt;</span><br>              <span class="hljs-tag">&lt;<span class="hljs-name">sequential</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;attParam = @&#123;attParam&#125;&quot;</span>/&gt;</span><br>           <span class="hljs-tag">&lt;/<span class="hljs-name">sequential</span>&gt;</span><br>    <span class="hljs-tag">&lt;/<span class="hljs-name">macrodef</span>&gt;</span><br>  <br>    <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;macrtest&quot;</span>&gt;</span><br>           <span class="hljs-tag">&lt;<span class="hljs-name">macro</span> <span class="hljs-attr">attParam</span>=<span class="hljs-string">&quot;this is my input&quot;</span>/&gt;</span><br>    <span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span><br><br><span class="hljs-tag">&lt;/<span class="hljs-name">project</span>&gt;</span><br></code></pre></td></tr></table></figure>

<h2 id="Ant中的JVM系统属性"><a href="#Ant中的JVM系统属性" class="headerlink" title="Ant中的JVM系统属性"></a>Ant中的JVM系统属性</h2><p>常用的JVM系统属性：os.name、 os.version、 basedir、 ant.java.version、 ant.home ant.version、 ant.file、 ant.project.name、 user.name、 user.home、 java.home</p>
<p>使用示例如下：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><code class="hljs xml">JVM系统属性：os.name os.version basedir ant.java.version ant.home ant.version ant.file ant.project.name user.name user.home java.home<br><br>E.G.：<br><br><span class="hljs-meta">&lt;?xml version=<span class="hljs-string">&quot;1.0&quot;</span> encoding=<span class="hljs-string">&quot;UTF-8&quot;</span>?&gt;</span><br><br><span class="hljs-tag">&lt;<span class="hljs-name">project</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;attribute&quot;</span> <span class="hljs-attr">default</span>=<span class="hljs-string">&quot;showProperty&quot;</span> &gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;who1&quot;</span> <span class="hljs-attr">location</span>=<span class="hljs-string">&quot;ant.file.attribute&quot;</span>/&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">dirname</span> <span class="hljs-attr">property</span>=<span class="hljs-string">&quot;antfile.dir&quot;</span> <span class="hljs-attr">file</span>=<span class="hljs-string">&quot;$&#123;ant.file.attribute&#125;&quot;</span>/&gt;</span><br><br>    <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;showProperty&quot;</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;Hello Property $&#123;antfile.dir&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">property</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;who2&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;taobaoge 2&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span>&gt;</span>Hello Propertiy<span class="hljs-tag">&lt;/<span class="hljs-name">echo</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;Hello Property 2&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;Hello $&#123;who1&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;Hello $&#123;who2&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;current OS is $&#123;os.name&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;current OS version is  $&#123;os.version&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;basedir is $&#123;basedir&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;Ant find version of JVM $&#123;ant.java.version&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;Ant use version $&#123;ant.home&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;Ant version $&#123;ant.version&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;ant.file = $&#123;ant.file&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;ant.project.name = $&#123;ant.project.name&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;classpath = $&#123;classpath&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;common.dir = $&#123;common.dir&#125;&quot;</span>/&gt;</span><br>    <span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span><br><br>    <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;jvm&quot;</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;user.name = $&#123;user.name&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;user.home = $&#123;user.home&#125;&quot;</span>/&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;java.home = $&#123;java.home&#125;&quot;</span>/&gt;</span><br>    <span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span><br><br>    <span class="hljs-tag">&lt;<span class="hljs-name">macrodef</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;echoinfo&quot;</span>&gt;</span><br>              <span class="hljs-tag">&lt;<span class="hljs-name">attribute</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;attParam&quot;</span> <span class="hljs-attr">description</span>=<span class="hljs-string">&quot;imput the attParam value&quot;</span>/&gt;</span><br>              <span class="hljs-tag">&lt;<span class="hljs-name">sequential</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">message</span>=<span class="hljs-string">&quot;attParam = @&#123;attParam&#125;&quot;</span>/&gt;</span><br>           <span class="hljs-tag">&lt;/<span class="hljs-name">sequential</span>&gt;</span><br>    <span class="hljs-tag">&lt;/<span class="hljs-name">macrodef</span>&gt;</span><br><br>    <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;testmacro&quot;</span>&gt;</span><br>           <span class="hljs-tag">&lt;<span class="hljs-name">echoinfo</span> <span class="hljs-attr">attParam</span>=<span class="hljs-string">&quot;this is my input&quot;</span>/&gt;</span><br>    <span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span><br><br><span class="hljs-tag">&lt;/<span class="hljs-name">project</span>&gt;</span><br></code></pre></td></tr></table></figure>



<p><strong>欢迎关注微信公众号，更多文章分享。</strong> <img src="/e-page/news/img/qrcode_for_ITSuperDaddy.jpg" srcset="/e-page/news/img/loading.gif" lazyload></p>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/e-page/news/categories/%E5%90%8E%E7%AB%AF/" class="category-chain-item">后端</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/e-page/news/tags/java/" class="print-no-link">#java</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>java构建工具ant简述</div>
      <div>https://yanpingdong.gitee.io/e-page/2023/10/09/java-build-tool-ant/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>YanpingDong</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2023年10月9日</div>
        </div>
      
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a class="print-no-link" target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/e-page/news/2023/10/20/how-to-write-hexo-theme/" title="怎么编写hexo主题-简介 1">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">怎么编写hexo主题-简介 1</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/e-page/news/2023/10/08/serial-version-uid/" title="什么是serialVersionUID">
                        <span class="hidden-mobile">什么是serialVersionUID</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header">
    <i class="iconfont icon-list"></i>
    <span>目录</span>
  </p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>E-page</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
    </div>
  
  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.4/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/e-page/news/js/events.js" ></script>
<script  src="/e-page/news/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/e-page/news/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.20.1/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.11/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/e-page/news/js/local-search.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/e-page/news/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
